fix: Inline optimization for constructor call pattern (Kotlin decompilation)#2767
Open
devload wants to merge 6 commits into
Open
fix: Inline optimization for constructor call pattern (Kotlin decompilation)#2767devload wants to merge 6 commits into
devload wants to merge 6 commits into
Conversation
Improves decompilation of Kotlin code that has instructions before this()/super() calls. Reduces "Illegal instructions before constructor call" warnings from 74 to 15 (80% improvement). Changes: - Add tryInlineSimpleInstructions() method for inlining expressions - Support inlining: SGET, IGET, CONST, CONST_STR, CONST_CLASS, CHECK_CAST, INVOKE - Inline into both constructor arguments and ternary conditions - Preserve semantics by only inlining single-use registers The remaining 15 cases are unsolvable due to Java language constraints: - Type A: Variable reuse in ternary (same var in condition and value) - Type B: Control flow (if/throw, loops) before constructor - Type C: Combined patterns Fixes skylot#2760 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- CONSTRUCTOR_CALL_FIX.md: Overview and issue tracking - docs/FIX_07_ROOT_CAUSE_ANALYSIS.md: Pipeline analysis - docs/FIX_07_BYTECODE_PATTERNS.md: Detailed bytecode patterns - docs/FIX_07_UNRESOLVED.md: 15 unsolvable cases Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace original README content with fork-specific documentation - Add issue tracking table for solved and unsolvable cases - Include pattern examples and build instructions - Link to detailed documentation in docs/ Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update README with constructor call fix information - Add issue tracking table (solved and unsolvable cases) - Add detailed documentation in docs/ - FIX_07_ROOT_CAUSE_ANALYSIS.md - FIX_07_BYTECODE_PATTERNS.md - FIX_07_UNRESOLVED.md Related issues: skylot#2760, skylot#2761, skylot#2762, skylot#2763, skylot#2764, skylot#2765, skylot#2766 PR: skylot#2767 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
MrIkso
reviewed
Jan 26, 2026
Contributor
There was a problem hiding this comment.
why did you break the readme?
Owner
There was a problem hiding this comment.
All commits were generated by Claude AI, so it is pointless to ask "why" 🤣
MrIkso
reviewed
Jan 26, 2026
Contributor
There was a problem hiding this comment.
why was this md file added, what is its use besides the text generated through ai?
…rison - Enhanced README with detailed pattern classification (Type A, B, C) - Added JADX source code analysis explaining warning generation - Added decompiler comparison (JADX vs CFR vs Fernflower vs Vineflower) - Included implementation details of PR skylot#2767 solution - Added future improvement roadmap - Created DECOMPILER_COMPARISON.md with detailed tool analysis - Referenced JEP draft for Java language evolution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves decompilation of Kotlin code that has instructions before
this()/super()calls, reducing "Illegal instructions before constructor call" warnings from 74 to 15 (80% improvement).Problem
When decompiling Kotlin code, JADX produces invalid Java because:
this()/super()in constructorsthis()/super()as the first statementSolution
Added inline optimization in
PrepareForCodeGen.java:Results
Remaining Cases
15 cases remain unsolvable due to Java language constraints:
Test Plan
./gradlew distRelated Issues
Fixes #2760